Introduction

Load libraries

library(Seurat)
library(canceRbits)
library(dplyr)
library(patchwork)
library(DT)
library(SCpubr)
library(tibble)
library(dittoSeq)
library(scRepertoire)
library(reshape2)
library(viridis)
library(tidyr)

library(grDevices)
library(ggpubr)
library(ggplot2)
library(ggnewscale)

library(RColorBrewer)
library(scales)

library(enrichplot)
library(clusterProfiler)
library("org.Hs.eg.db")
library(DOSE)
library(msigdbr)
library(stringr)

Load single cell RNA-Seq data

# Load seurat object containing single cell pre-processed and annotated data, in the metadata folder

srat <- readRDS(params$path_to_data)
meta <- srat@meta.data
meta$WHO <- "SD"
meta$WHO[meta$patient %in% c("NeoBCC007_post", "NeoBCC008_post", "NeoBCC012_post", "NeoBCC017_post")] <- "CR"
meta$WHO[meta$patient %in% c("NeoBCC004_post", "NeoBCC006_post", "NeoBCC010_post", "NeoBCC011_post")] <- "PR"
srat <- AddMetaData(srat, meta$WHO, col.name = "WHO")
srat$WHO <- factor(srat$WHO, levels = c("CR", "PR", "SD"))

colors

colors_B <- c(
  "34" = "#ae017e",
  "7"  =  "#377eb8",
  "21" =  "#f781bf",  
  "38" = "#fed976",
  "15" = "#a6cee3" ,
  "22" = "#e31a1c"   ,
   "3" = "#9e9ac8",
 "4"   = "#fdb462" ,
 "24"  = "#b3de69"
)


colors_clonotype = c("Small (1e-04 < X <= 0.001)"   = "#8c6bb1",
           "Medium (0.001 < X <= 0.01)"   = "#41b6c4",
           "Large (0.01 < X <= 0.1)"      = "#fec44f",
           "Hyperexpanded (0.1 < X <= 1)" = "#ce1256"
)
s   <- subset(srat, subset = anno_l1 %in% c("B cells","Plasma cells"))

s@meta.data$seurat_clusters <- factor(s@meta.data$seurat_clusters, levels=c("34","7", "21",  "38",
                                                                             "15", "22","3", "4", "24"))

Extended Data Figure 9a

df <- s@meta.data %>%
    mutate_if(sapply(s@meta.data, is.character), as.factor)  %>% 
    group_by( Pathological.Response, patient, seurat_clusters,    .drop = FALSE)%>% 
  summarise(Nb = n()) %>%
  mutate(C = sum(Nb)) %>%
  mutate(percent = Nb/C*100) %>%
  filter(percent != "NaN") %>%
  arrange(Pathological.Response, percent)




tmp <- df[df$seurat_clusters %in% c("34"),]


p1 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#dd3497", "#ae017e"), 
         point.size = 2, 
         xlab = "", 
         ylab = "Percentage (%)") + 
  ylim(c(0,90)) +
   ggtitle("C34") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 



tmp <- df[df$seurat_clusters %in% c("7"),]


p2 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#1d91c0", "#253494"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C7") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("21"),]


p3 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" ,  
         
         palette= c("white", "#fde0dd", "#fa9fb5"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C21") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("38"),]


p4 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#ffffcc", "yellow"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") +
  ylim(c(0,90)) +
   ggtitle("C38") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("15"),]


p5 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#deebf7", "#9ecae1"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C15") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("22"),]


p6 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#fc9272", "#ef3b2c"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C22") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("3"),]


p7 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#decbe4", "#c2a5cf"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C3") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("4"),]


p8 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#fee0b6", "#fec44f"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C4") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("24"),]


p9 <- ggpaired(tmp, 
         x = "Pathological.Response", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "Pathological.Response" , 
         palette= c("white", "#b8e186", "#7fbc41"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C24") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.format", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("pCR", "non-pCR")),
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

p <- p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + plot_layout(nrow = 1, guides = "collect")
p

DT::datatable(rbind(p1$data, p2$data, p3$data, p4$data, p5$data, p6$data, p7$data, p8$data, p9$data), 
              caption = ("Extended Data Figure 9A"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
s$WHO <- factor(s$WHO, levels = c("CR","PR","SD"))
df <- s@meta.data %>%
    mutate_if(sapply(s@meta.data, is.character), as.factor)  %>% 
    group_by( WHO, patient, seurat_clusters,    .drop = FALSE)%>% 
  summarise(Nb = n()) %>%
  mutate(C = sum(Nb)) %>%
  mutate(percent = Nb/C*100) %>%
  filter(percent != "NaN") %>%
  arrange(WHO, percent)




tmp <- df[df$seurat_clusters %in% c("34"),]


p1 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#dd3497", "#ae017e"), 
         point.size = 2, 
         xlab = "", 
         ylab = "Percentage (%)") + 
  ylim(c(0,90)) +
   ggtitle("C34") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 



tmp <- df[df$seurat_clusters %in% c("7"),]


p2 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#1d91c0", "#253494"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C7") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("21"),]


p3 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" ,  
         
         palette= c("white", "#fde0dd", "#fa9fb5"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C21") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("38"),]


p4 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#ffffcc", "yellow"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") +
  ylim(c(0,90)) +
   ggtitle("C38") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("15"),]


p5 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#deebf7", "#9ecae1"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
   ggtitle("C15") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("22"),]


p6 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#fc9272", "#ef3b2c"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C22") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("3"),]


p7 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#decbe4", "#c2a5cf"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C3") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

tmp <- df[df$seurat_clusters %in% c("4"),]


p8 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#fee0b6", "#fec44f"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C4") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 


tmp <- df[df$seurat_clusters %in% c("24"),]


p9 <- ggpaired(tmp, 
         x = "WHO", 
         y = "percent", 
         id="patient", 
         color = "black", 
         fill = "WHO" , 
         palette= c("white", "#b8e186", "#7fbc41"), 
         point.size = 2, 
         xlab = "", 
         ylab = "") + 
  ylim(c(0,90)) +
  ggtitle("C24") + NoLegend() +
  stat_compare_means( method = "wilcox.test", 
                      paired = FALSE, 
                      label.y = 80, 
                      hide.ns = FALSE, 
                      label = "p.signif", 
                      label.x.npc = "center", 
                      bracket.size = 1, 
                      comparison = list(c("CR", "SD"), c("SD", "PR"), c("CR", "PR")), 
                      size = 8)  +
  theme(text = element_text(size = 18),axis.text.x = element_text(angle = 90,  vjust=0.5)) 

p <- p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + plot_layout(nrow = 1, guides = "collect")
p

DT::datatable(rbind(p1$data, p2$data, p3$data, p4$data, p5$data, p6$data, p7$data, p8$data, p9$data), 
              caption = ("Extended Data Figure 9A"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))

Extended Data Figure 9b

p1 <- Seurat::VlnPlot(s, 
                     features = "HLA-DRA", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p1 <- p1 + geom_boxplot(width=0.3, fill="white")

f1 <- SCpubr::do_FeaturePlot(s, 
                     features = "HLA-DRA", legend.position = "right", legend.length = 4)


p2 <- Seurat::VlnPlot(s, 
                     features = "GZMK", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p2 <- p2 + geom_boxplot(width=0.3, fill="white")

f2 <- SCpubr::do_FeaturePlot(s, 
                     features = "GZMK", legend.position = "right", legend.length = 4)



p3 <- Seurat::VlnPlot(s, 
                     features = "CD27", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p3 <- p3 + geom_boxplot(width=0.3, fill="white")

f3 <- SCpubr::do_FeaturePlot(s, 
                     features = "CD27", legend.position = "right", legend.length = 4)


p4 <- Seurat::VlnPlot(s, 
                     features = "XBP1", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p4 <- p4 + geom_boxplot(width=0.3, fill="white")

f4 <- SCpubr::do_FeaturePlot(s, 
                     features = "XBP1", legend.position = "right", legend.length = 4)



c1 <- f1+p1  + plot_layout(ncol = 2,  widths   = c(1,2)) 
c2 <- f2+p2  + plot_layout(ncol = 2,  widths   = c(1,2))
c3 <- f3+p3  + plot_layout(ncol = 2,  widths   = c(1,2))
c4 <- f4+p4  + plot_layout(ncol = 2,  widths   = c(1,2))

c1

DT::datatable(f1$data, 
              caption = ("EDFigure 9Ba_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
c2

DT::datatable(f2$data, 
              caption = ("EDFigure 9Bb_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
c3

DT::datatable(f3$data, 
              caption = ("EDFigure 9Bc_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
c4

DT::datatable(f4$data, 
              caption = ("EDFigure 9Bd_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p1$data, 
              caption = ("EDFigure 9Ba_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p2$data, 
              caption = ("EDFigure 9Bb_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p3$data, 
              caption = ("EDFigure 9Bc_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p4$data, 
              caption = ("EDFigure 9Bd_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))

Extended Data Figure 9C

p1 <- Seurat::VlnPlot(s, 
                     features = "PRF1", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p1 <- p1 + geom_boxplot(width=0.3, fill="white")

f1 <- SCpubr::do_FeaturePlot(s, 
                     features = "PRF1", legend.position = "right", legend.length = 4)


p2 <- Seurat::VlnPlot(s, 
                     features = "IL10", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p2 <- p2 + geom_boxplot(width=0.3, fill="white")

f2 <- SCpubr::do_FeaturePlot(s, 
                     features = "IL10", legend.position = "right", legend.length = 4)



p3 <- Seurat::VlnPlot(s, 
                     features = "TGFB1", 
                     group.by = "seurat_clusters", 
                     pt.size = 0,  
                     cols = colors_B) & NoLegend() 
p3 <- p3 + geom_boxplot(width=0.3, fill="white")

f3 <- SCpubr::do_FeaturePlot(s, 
                     features = "TGFB1", legend.position = "right", legend.length = 4)





c1 <- f1+p1  + plot_layout(ncol = 1,  heights =  c(1,1)) 
c2 <- f2+p2  + plot_layout(ncol = 1,  heights = c(1,1))
c3 <- f3+p3  + plot_layout(ncol = 1,  heights = c(1,1))

c1

DT::datatable(f1$data, 
              caption = ("ExtendedData_Figure9Ca_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p1$data, 
              caption = ("ExtendedData_Figure9Ca_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
c2

DT::datatable(f2$data, 
              caption = ("ExtendedData_Figure9Cb_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p2$data, 
              caption = ("ExtendedData_Figure9Cb_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
c3

DT::datatable(f3$data, 
              caption = ("ExtendedData_Figure9Cc_FeaturePlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))
DT::datatable(p3$data, 
              caption = ("ExtendedData_Figure9Cc_VlnPlot"),
              extensions = 'Buttons', 
              options = list( dom = 'Bfrtip',
              buttons = c( 'csv', 'excel')))

Session Info

sessionInfo()
## R version 4.3.0 (2023-04-21)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Europe/Vienna
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] stringr_1.5.1         msigdbr_7.5.1         DOSE_3.26.2           org.Hs.eg.db_3.17.0  
##  [5] AnnotationDbi_1.62.2  IRanges_2.34.1        S4Vectors_0.38.2      Biobase_2.60.0       
##  [9] BiocGenerics_0.46.0   clusterProfiler_4.8.3 enrichplot_1.20.3     scales_1.3.0         
## [13] RColorBrewer_1.1-3    ggnewscale_0.4.10     tidyr_1.3.1           scRepertoire_1.10.1  
## [17] dittoSeq_1.12.2       canceRbits_0.1.6      ggpubr_0.6.0.999      ggplot2_3.5.1        
## [21] viridis_0.6.5         viridisLite_0.4.2     reshape2_1.4.4        tibble_3.2.1         
## [25] SCpubr_2.0.2          DT_0.32               patchwork_1.2.0       dplyr_1.1.4          
## [29] Seurat_5.0.3          SeuratObject_5.0.1    sp_2.1-3             
## 
## loaded via a namespace (and not attached):
##   [1] fs_1.6.4                    matrixStats_1.2.0           spatstat.sparse_3.0-3      
##   [4] bitops_1.0-7                HDO.db_0.99.1               httr_1.4.7                 
##   [7] doParallel_1.0.17           tools_4.3.0                 sctransform_0.4.1          
##  [10] backports_1.4.1             utf8_1.2.4                  R6_2.5.1                   
##  [13] vegan_2.6-4                 lazyeval_0.2.2              uwot_0.1.16                
##  [16] mgcv_1.9-1                  permute_0.9-7               withr_3.0.0                
##  [19] gridExtra_2.3               progressr_0.14.0            cli_3.6.2                  
##  [22] spatstat.explore_3.2-7      fastDummies_1.7.3           scatterpie_0.2.1           
##  [25] isoband_0.2.7               labeling_0.4.3              sass_0.4.9                 
##  [28] spatstat.data_3.0-4         ggridges_0.5.6              pbapply_1.7-2              
##  [31] yulab.utils_0.1.4           gson_0.1.0                  stringdist_0.9.12          
##  [34] parallelly_1.37.1           limma_3.56.2                RSQLite_2.3.5              
##  [37] VGAM_1.1-10                 rstudioapi_0.16.0           generics_0.1.3             
##  [40] gridGraphics_0.5-1          ica_1.0-3                   spatstat.random_3.2-3      
##  [43] crosstalk_1.2.1             car_3.1-2                   GO.db_3.17.0               
##  [46] Matrix_1.6-5                ggbeeswarm_0.7.2            fansi_1.0.6                
##  [49] abind_1.4-5                 lifecycle_1.0.4             edgeR_3.42.4               
##  [52] yaml_2.3.8                  carData_3.0-5               SummarizedExperiment_1.30.2
##  [55] qvalue_2.32.0               Rtsne_0.17                  blob_1.2.4                 
##  [58] grid_4.3.0                  promises_1.2.1              crayon_1.5.2               
##  [61] miniUI_0.1.1.1              lattice_0.22-6              cowplot_1.1.3              
##  [64] KEGGREST_1.40.1             pillar_1.9.0                knitr_1.45                 
##  [67] fgsea_1.26.0                GenomicRanges_1.52.1        future.apply_1.11.1        
##  [70] codetools_0.2-19            fastmatch_1.1-4             leiden_0.4.3.1             
##  [73] glue_1.7.0                  downloader_0.4              ggfun_0.1.5                
##  [76] data.table_1.15.2           treeio_1.24.3               vctrs_0.6.5                
##  [79] png_0.1-8                   spam_2.10-0                 gtable_0.3.5               
##  [82] assertthat_0.2.1            cachem_1.1.0                xfun_0.43                  
##  [85] S4Arrays_1.0.6              mime_0.12                   tidygraph_1.3.1            
##  [88] survival_3.5-8              DElegate_1.2.1              SingleCellExperiment_1.22.0
##  [91] pheatmap_1.0.12             iterators_1.0.14            fitdistrplus_1.1-11        
##  [94] ROCR_1.0-11                 nlme_3.1-164                ggtree_3.13.0.001          
##  [97] bit64_4.0.5                 RcppAnnoy_0.0.22            evd_2.3-6.1                
## [100] GenomeInfoDb_1.36.4         bslib_0.6.2                 irlba_2.3.5.1              
## [103] vipor_0.4.7                 KernSmooth_2.23-22          DBI_1.2.2                  
## [106] colorspace_2.1-0            ggrastr_1.0.2               tidyselect_1.2.1           
## [109] bit_4.0.5                   compiler_4.3.0              SparseM_1.81               
## [112] DelayedArray_0.26.7         plotly_4.10.4               shadowtext_0.1.3           
## [115] lmtest_0.9-40               digest_0.6.35               goftest_1.2-3              
## [118] spatstat.utils_3.0-4        rmarkdown_2.26              XVector_0.40.0             
## [121] htmltools_0.5.8             pkgconfig_2.0.3             sparseMatrixStats_1.12.2   
## [124] MatrixGenerics_1.12.3       highr_0.10                  fastmap_1.2.0              
## [127] rlang_1.1.4                 htmlwidgets_1.6.4           shiny_1.8.1                
## [130] farver_2.1.2                jquerylib_0.1.4             zoo_1.8-12                 
## [133] jsonlite_1.8.8              BiocParallel_1.34.2         GOSemSim_2.26.1            
## [136] RCurl_1.98-1.14             magrittr_2.0.3              GenomeInfoDbData_1.2.10    
## [139] ggplotify_0.1.2             dotCall64_1.1-1             munsell_0.5.1              
## [142] Rcpp_1.0.12                 evmix_2.12                  babelgene_22.9             
## [145] ape_5.8                     reticulate_1.35.0           truncdist_1.0-2            
## [148] stringi_1.8.4               ggalluvial_0.12.5           ggraph_2.2.1               
## [151] zlibbioc_1.46.0             MASS_7.3-60.0.1             plyr_1.8.9                 
## [154] parallel_4.3.0              listenv_0.9.1               ggrepel_0.9.5              
## [157] forcats_1.0.0               deldir_2.0-4                Biostrings_2.68.1          
## [160] graphlayouts_1.1.1          splines_4.3.0               tensor_1.5                 
## [163] locfit_1.5-9.9              igraph_2.0.3                spatstat.geom_3.2-9        
## [166] cubature_2.1.0              ggsignif_0.6.4              RcppHNSW_0.6.0             
## [169] evaluate_0.23               foreach_1.5.2               tweenr_2.0.3               
## [172] httpuv_1.6.15               RANN_2.6.1                  purrr_1.0.2                
## [175] polyclip_1.10-6             future_1.33.2               scattermore_1.2            
## [178] ggforce_0.4.2               broom_1.0.5                 xtable_1.8-4               
## [181] tidytree_0.4.6              RSpectra_0.16-1             rstatix_0.7.2              
## [184] later_1.3.2                 gsl_2.1-8                   aplot_0.2.3                
## [187] beeswarm_0.4.0              memoise_2.0.1               cluster_2.1.6              
## [190] powerTCR_1.20.0             globals_0.16.3